/*    */ package blockbuster.components.lifetime;
/*    */ 
/*    */ import blockbuster.components.BedrockComponentBase;
/*    */ import blockbuster.components.IComponentEmitterUpdate;
/*    */ import blockbuster.math.Constant;
/*    */ import blockbuster.math.IValue;
/*    */ import blockbuster.math.molang.MolangException;
/*    */ import blockbuster.math.molang.MolangParser;
/*    */ import blockbuster.math.molang.expressions.MolangExpression;
/*    */ import blockbuster.math.molang.expressions.MolangValue;
/*    */ import com.google.gson.JsonElement;
/*    */ import com.google.gson.JsonObject;
/*    */ 
/*    */ public abstract class BedrockComponentLifetime extends BedrockComponentBase implements IComponentEmitterUpdate {
/* 15 */   public static final MolangExpression DEFAULT_ACTIVE = (MolangExpression)new MolangValue(null, (IValue)new Constant(10.0D));
/*    */   
/* 17 */   public MolangExpression activeTime = DEFAULT_ACTIVE;
/*    */ 
/*    */   
/*    */   public BedrockComponentBase fromJson(JsonElement elem, MolangParser parser) throws MolangException {
/* 21 */     if (!elem.isJsonObject())
/*    */     {
/* 23 */       return super.fromJson(elem, parser);
/*    */     }
/*    */     
/* 26 */     JsonObject element = elem.getAsJsonObject();
/*    */     
/* 28 */     if (element.has(getPropertyName()))
/*    */     {
/* 30 */       this.activeTime = parser.parseJson(element.get(getPropertyName()));
/*    */     }
/*    */     
/* 33 */     return super.fromJson((JsonElement)element, parser);
/*    */   }
/*    */ 
/*    */ 
/*    */   
/*    */   public JsonElement toJson() {
/* 39 */     JsonObject object = new JsonObject();
/*    */     
/* 41 */     if (!MolangExpression.isConstant(this.activeTime, 10.0D))
/*    */     {
/* 43 */       object.add(getPropertyName(), this.activeTime.toJson());
/*    */     }
/*    */     
/* 46 */     return (JsonElement)object;
/*    */   }
/*    */ 
/*    */   
/*    */   protected String getPropertyName() {
/* 51 */     return "active_time";
/*    */   }
/*    */ 
/*    */ 
/*    */   
/*    */   public int getSortingIndex() {
/* 57 */     return -10;
/*    */   }
/*    */ }


/* Location:              D:\fanbian\[D][龙之核心]DragonCore-2.6.0.3.jar!\blockbuster\components\lifetime\BedrockComponentLifetime.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */